# Maintainer: Andreas Radke <andyrtr@archlinux.org>
# Contributor: buddabrod <buddabrod@gmail.com>

pkgname=xf86-video-nouveau
pkgver=1.0.15
pkgrel=3
pkgdesc="Open Source 2D acceleration driver for nVidia cards"
arch=('x86_64')
url="http://nouveau.freedesktop.org/"
license=('GPL')
depends=('libsystemd' 'mesa')
makedepends=('xorg-server-devel' 'X-ABI-VIDEODRV_VERSION=24.0' 'systemd')
conflicts=('xorg-server<1.20' 'X-ABI-VIDEODRV_VERSION<24' 'X-ABI-VIDEODRV_VERSION>=25')
groups=('xorg-drivers')
source=(https://xorg.freedesktop.org/archive/individual/driver/$pkgname-$pkgver.tar.bz2{,.sig})
sha256sums=('aede10fd395610a328697adca3434fb14e9afbd79911d6c8545cfa2c0e541d4c'
            'SKIP')
validpgpkeys=('B97BD6A80CAC4981091AE547FE558C72A67013C3') # Maarten Lankhorst <maarten@debian.org>
validpgpkeys=('C9FA6B58BC799041500F769AC5469FB8758F9C2B') # "Lyude Paul <lyude@redhat.com>"

#prepare() {
#  cd $pkgname-$pkgver
#}

build() {
  cd $pkgname-$pkgver

  # Since pacman 5.0.2-2, hardened flags are now enabled in makepkg.conf
  # With them, module fail to load with undefined symbol.
  # See https://bugs.archlinux.org/task/55102 / https://bugs.archlinux.org/task/54845
  export CFLAGS=${CFLAGS/-fno-plt}
  export CXXFLAGS=${CXXFLAGS/-fno-plt}
  export LDFLAGS=${LDFLAGS/,-z,now}

  ./configure --prefix=/usr
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
}
